import sqlite3

from sqlalchemy import create_engine, text
from sqlalchemy.exc import SQLAlchemyError

from config import DB_URL
engine = create_engine(DB_URL)
def select_all_city():
    sql=text('select * from cityjs')
    try:
        with engine.connect() as conn:
            conn.execute(sql)
            conn.commit()
            print("select all city")

    except SQLAlchemyError as e:
        print("select all city error")


def select_city_by_cityjsname(cityname):
    sql=text('select * from cityjs where name=cityname')
    try:
        with engine.connect() as conn:
            conn.execute(sql)
            conn.commit()
            print("select city by cityname")
    except SQLAlchemyError as e:
        print("select city by cityname error")



